<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	$kboy_userid = $_SESSION['kboy_userid'];
	$kboy_user = $_SESSION['kboy_user'];
	
	$uid = chkstr(trim($_REQUEST['uid']));
	$ac = chkstr(trim($_REQUEST['ac']));
	if(empty($uid)){
		echo erro("参数错误");
	}
	if(!is_numeric($uid)){
		echo erro("参数错误");
	}
	if(getNewsNums("kboy_user","uid=$uid") <1){
		echo erro("参数错误");
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的活动_社区_<?= $web_titles ?></title>
<meta name="Keywords" content="我的活动,社区,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
	<? include("_include.forum.banners.php") ?>
    <!--banner end-->
    <!--活动 begin-->
    <div class="sq-wrap">
		<? include("_include.forum.title.php") ?>
        <div class="sq-bd">
			<? include("_include.forum.topnav.php") ?>
            <div class="sq-bd-con">
                <div class="sq-bd-l">
                    <div class="sq-photo-wrap">
					 <?php
					            $SQL = " where 1=1   ";
								if($ac=='bao'){
								 $SQL =$SQL." and   uid=$uid  and active_model = 0  and active_state = 0 ";
								}
								if($ac=='can'){
								 $SQL =$SQL." and id in ( select `aid` from kboy_order where uid = '".$uid."' )  ";
								}
								if($ac=='gan'){
								 $SQL =$SQL." and id in ( select `newsid` from kboy_forum_favorite  where uid = '".$uid."' )  ";
								}
								if(!$ac){
								$SQL =$SQL." and uid=$uid  and active_model = 0  ";
								}
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_active ".$SQL." order by active_top desc,active_order desc, id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
					 ?>
                        <div class="travel-hd">
                            <div class="title"><?php if($_SESSION['kboy_userid'] == $uid) {?>我<?php }else{ ?>ta<?php } ?>的活动</div>
                            <div class="yj-num"><span><?php echo getNewsNums('kboy_forum_active'," uid=$uid and active_model=0 and active_state=0");?></span>个活动</div>
                        </div>
                        <div class="hd-top-nav">
                            <ul>
                                <li <? if($ac==""){ echo " class=\"on\"";}?>><a href="forum_active.php?uid=<?=$uid?>&ac=bao">报名中活动</a></li>
                                <li <? if($ac=="can"){ echo " class=\"on\"";}?>><a href="forum_active.php?uid=<?=$uid?>&ac=can">已参加活动</a></li>
                                <li <? if($ac=="gan"){ echo " class=\"on\"";}?>><a href="forum_active.php?uid=<?=$uid?>&ac=gan">感兴趣活动</a></li>
                                <div class="hd-total">共计<span><?php echo $pagenum;?></span>个活动</div>
                            </ul>
                        </div>
                        <div class="hd-bd-content">
                            <div class="hd-bd-list">
							<?php
								
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_assoc($news_rows)){
								
							?>
								<dl class="hd-bd-item">
                                    <dt><a href="activeview.php?newsid=<?php echo $news_rs['id'];?>"><img src="<?php echo $news_rs['active_pic'];?>" width="200" height="200" alt=""/></a></dt>
                                    <dd>
                                        <div class="hd-info">
                                            <h3 class="title"><a href="activeview.php?newsid=<?php echo $news_rs['id'];?>"><?php echo $news_rs['active_title'];?></a></h3>
                                            <div class="editor-inner">
                                                <span class="editor">领队：<a href="#"><?php echo $news_rs['active_end_user'];?></a></span>
                                                <span class="date"><?php echo date("Y/m/d",strtotime($news_rs['active_addtime'],time()));?></span>
                                                <div class="show-pl">
                                                    <span class="watch"><i></i><?php echo $news_rs['active_hits'];?></span>
                                                    <span class="pl"><i></i> <?=getNewsNums("kboy_active_message","newsid=".$news_rs['id']);?></span>
                                                    <span class="good"><i></i><?=getNewsNums("kboy_forum_favorite","newsid=".$news_rs['id']."  group by uid");?></span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="md-info">
                                            <div class="item">
                                                <span class="icon point-c"><i></i><em><?php echo $news_rs['active_start_city'];?></em>出发</span>
                                                <span class="icon point-q"><i></i>去往<em><?php echo $news_rs['active_end_prov'].'&nbsp;'.$news_rs['active_end_city'];?> </em></span>
                                                <span class="icon fun"><i></i><em><?php echo $news_rs['active_hd_content'];?></em></span>
                                            </div>
                                            <div class="item">
                                                <span class="icon point-d"><i></i><em><?php echo $news_rs['active_jingdian'];?></em></span>
                                                <span class="icon time"><i></i><em><?php echo date("Y/m/d",strtotime($news_rs['active_start_time'],time()));?> - <?php echo date("Y/m/d",strtotime($news_rs['active_end_time'],time()));?></em></span>
                                            </div>
                                        </div>
                                        <div class="bd-info">
                                            <ul>
                                                <li class="bd-hd"><a href="javascript:;"><?php echo getClassName('kboy_bigclass','bigclass_cn',"id = ".$news_rs['active_bigclass']);?></a></li>
												<!--
                                                <li class="bd-dd">带队次数/带队人数：<span><i>603</i> / <i>16204</i></span> </li>
												-->
                                            </ul>
                                        </div>
                                    </dd>
                                </dl>
							<?php
								}
							?>
                                <div class="clearfix"></div>
                            </div>
                            <?php
									if($pagenum > $pagesize){
										echo "<div class=\"pagination\"><ul>";
										$url = "forum_active.php?uid=$uid&ac=$ac";//当前页面
										pagebar($pagecount, $pageval, 7, $url);
										echo "</ul></div>";
									}
							?>
                        </div>
                    </div>
                </div>
				
				
				<? include("_include.forum.right.php") ?>
				
				
				
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
</body>
</html>

